package com.henghai.zhenxuan.ui.page.adapter;

import android.content.Context;

import androidx.recyclerview.widget.RecyclerView;

import com.henghai.zhenxuan.data.bean.MyFastMailBean;
import com.henghai.zhenxuan.databinding.AdapterMyfastmailItemBinding;
import com.kunminx.binding_recyclerview.adapter.SimpleDataBindingAdapter;

public class MyFastMailAdapter extends SimpleDataBindingAdapter<MyFastMailBean, AdapterMyfastmailItemBinding> {
    private OnItemBtClickListener listener;

    public MyFastMailAdapter(Context context) {
        super(context, com.henghai.zhenxuan.R.layout.adapter_myfastmail_item, DiffUtils.getInstance().getMyFastMailItemCallback());
    }

    @Override
    protected void onBindItem(AdapterMyfastmailItemBinding binding, MyFastMailBean item, RecyclerView.ViewHolder holder) {
        binding.setFastmail(item);
        binding.fastmaliTag.setOnClickListener(v-> listener.onItemDelClick(item,holder.getBindingAdapterPosition()));
    }

    public void setListener(OnItemBtClickListener listener) {
        this.listener = listener;
    }

    public interface OnItemBtClickListener {
        void onItemDelClick(MyFastMailBean bean, int postion);
    }
}
